import React, { useState } from "react";
import { RouterProvider, createBrowserRouter } from "react-router-dom";
import routes from "./router/Index";
import { Button, ConfigProvider, Input, Space, theme as antdTeme } from "antd";
function App() {
  const [data, setData] = useState("light");
  return (
    <div>
      <ConfigProvider
        theme={{
          // 1. 单独使用暗色算法
          algorithm:
            data === "bark"
              ? antdTeme.darkAlgorithm
              : antdTeme.defaultAlgorithm,

          // 2. 组合使用暗色算法与紧凑算法
          // algorithm: [theme.darkAlgorithm, theme.compactAlgorithm],
        }}
      >
        <Button
          type="primary"
          onClick={() => setData(data === "bark" ? "light" : "bark")}
        >
          {data === "bark" ? "黑" : "白"}
        </Button>
        <RouterProvider router={createBrowserRouter(routes)}></RouterProvider>
      </ConfigProvider>
    </div>
  );
}

export default App;
